using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using ZSW.Framework;

namespace Main.Plyaer
{
    public class TriggerItemFader : ZSWF_MonoBehaviour
    {
        private ICanFade fader = null;
        private void OnTriggerEnter2D(Collider2D other)
        {
            if (other.TryGetComponent(out fader))
            {
                fader.FadeOut(Settings.treeFadeOutAlpha, Settings.ITEM_FADE_DURATION);
            }
        }

        private void OnTriggerExit2D(Collider2D other)
        {
            if (fader != null)
            {
                fader.FadeIn(Settings.treeFadeInAlpha, Settings.ITEM_FADE_DURATION);
                fader = null;
            }
        }
    }
}

